package com.yunti.yntk.db;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Entity;
import androidx.room.Insert;
import androidx.room.Query;
import com.yunti.yntk.db.po.ExamStu;
import com.yunti.yntk.db.po.LocalRecord;

import java.util.List;
import java.util.Locale;

@Dao
@Entity
public interface LocalRecordDao {
    @Query("SELECT * FROM local_record order by id desc")
    List<LocalRecord> getAll();

    @Query("SELECT * FROM local_record order by id desc LIMIT :limit OFFSET :offset")
    List<LocalRecord> getListByPage(int limit, int offset);

    @Query("SELECT * FROM local_record where xmmc = :xmmc and name = :stuName and count = :count order by id desc LIMIT 8")
    List<LocalRecord> getHistoryList(String xmmc,String stuName,int count);

    @Query("SELECT * FROM local_record where xmmc = :xmmc order by id desc LIMIT 8")
    List<LocalRecord> getHistoryList(String xmmc);

    @Query("SELECT count(1) FROM local_record")
    int getCount();

    @Insert
    void insertAll(LocalRecord... yns);

    @Insert
    void insertAll(List<LocalRecord> yns);

    @Query("DELETE FROM local_record")
    void deleteAll();


}
